<?php  session_start();
/**
* @package		Parents@School
* @copyright	                Copyright (C) 2008 Kristof Beckers. All rights reserved.
* @Version		2.0
* @license		GNU/GPL, see LICENSE.php
**/
 
include ("include/config.php");
require_once ("include/db.php");
//include ("include/header.php");
//if ($_SESSION['admin'] == "$adminid"){
//	header("location:admin/index.php");
//	}
$user=$_GET['username1'];
$klas = $_GET['klas'];
$status = $_GET['status'];

$lastpage = $_SERVER['HTTP_REFERER'];
$lastpage1 = explode("?", $lastpage);
if ($status == "1" )
			{
				if ($lastpage1[0] != $workurl. "users/change_user.php")
				{
					header("location:index.php");
					

				}
				else {
								//$user = $_SESSION['myusername'];	
								//De sessie in een variabele plaatsen
								//Hier gaan we de adresgegevens van de huidige lln opzoeken om te controleren of er nog lln op dit adres wonen.
								$sql="SELECT * FROM $tbusers WHERE username='$user'" ;
								$result = mysql_query($sql) or die (mysql_error());
										while ($row = mysql_fetch_array($result))
										{
										$username = $row['username'];
										/*$stamboeknr = $row['stamboeknr'];
										$straat = $row['straat'];
										$huisnr = $row['huisnr'];
										$postcode = $row['postcode'];
										$gemeente = $row['gemeente'];*/
										}
										$num_rows1 = mysql_num_rows($result);
										
												if ($username == $user)
												{
												//session_regenerate_id('true');
												$_SESSION['myusername'] = $username ;
												$_SESSION['klas'] = $klas ;
												$_SESSION['multiple'] = "TRUE";
												header("location:index.php?status=$status");
												}
												else
												{
													header("location:index.php");
													

												}
								}
				}
			


//print_r($_SESSION);


?>
